package cn.kongwg.myporxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author kongwg
 * @create 2021-05-16 10:24
 */
public class Agent implements InvocationHandler {

    private Singer singer;

    public Agent(Singer singer) {
        this.singer = singer;
    }

    @Override
    public Object invoke(Object o, Method method, Object[] objects) throws Throwable {
        System.out.println("代理的开始");
        Object invoke = method.invoke(singer,objects);
        System.out.println("代理的结束");
        return invoke;

    }
}
